<template>
  <el-dialog :title="title" :visible.sync="visible" width="600px" @closed="close">
    <div class="detail-content">
      <el-timeline>
        <el-timeline-item v-for="(item,index) in recordData" :key="index" :timestamp="item.createTime" placement="top">
          <el-card>
            <p class="exchange-title">{{ item.createUser }}</p>
            <p class="row-content">{{ item.traceDesc }}</p>
            <p class="row-content">{{ item.marker }}：<span class="orange">{{ item.other }}</span></p>
            <p class="row-content row-right" style="">发生部门：{{ item.orgName }}</p>
          </el-card>
        </el-timeline-item>
      </el-timeline>
    </div>
  </el-dialog>
</template>

<script>
  import { parseTime } from '@/utils'
  import { queryOrderFlowInfoCommon } from '@/api'
  export default {
    name: 'reminderDialog',
    props: {
      clientSelected: {
        type: Object,
        default: () => { return {} }
      }
    },
    data() {
      return {
        visible: false,
        title: '流转信息',
        recordData: []
      }
    },
    methods: {
      open(val, type) {
        return new Promise((resolve) => {
          this.resolve = resolve
          this.visible = true
          if (val) {
            this.currentRow = val
            this.type = type
            this.title = this.type === 'repair' ? '报修流转信息--单号' + this.currentRow.repairCode : '投诉流转信息'
            this.getRecordData()
          }
        })
      },
      async getRecordData() {
        const param = {
          billCode: this.type === 'repair' ? this.currentRow.repairCode : this.currentRow.complainId,
          billType: this.type === 'repair' ? 2 : 4
          // corpSN: this.clientSelected.corpSN
        }
        const res = await queryOrderFlowInfoCommon(param)
        this.recordData = res.data
        this.recordData.forEach((item) => {
          item.createTime = parseTime(item.createTime)
        })
      },
      close() {
        this.visible = false
        this.query = {
          remark: '',
          radio: ''
        }
      }
    }
  }
</script>

<style lang="scss" scoped>
  .detail-content {
    max-height: 350px;
  }
  .exchange-title {
    padding: 10px 5px;
    font-size: 16px;
    font-weight: 600;
  }
  .row-content {
    padding: 5px;
  }
  .row-right {
    display: flex;
    flex-direction: row-reverse;
    font-size: 16px;
  }
  .orange {
    color: #ED912E;
  }
</style>
